<?php
namespace app\index\domain;

class Form extends Base
{
    public function __construct($id)
    {
         $this->_self = D('Form')->getInfo($id);
    }

    public function valueGet($key)
    {
        $result=$this->getSelf($key)
        if(isset($result))
            return $result;
        return null;
    }

    /**
     * 所属栏目
     */
    public function getTerm($id)
    {
        return Classes::get('TermById', $this->getSelf($key));
    }

    /**
     * 获取内容数据
     */
    public function getSelf($field)
    {
        if(!isset($this->_self[$field]))
            return null;
        return $this->_self[$field];
    }

    /**
     * 获取此内容页的地址
     */
    public function getUrl()
    {
        $url = U('index/Form', ['id'=>$this['id'], 'flag'=>$this['term']['flag']]);
        return $url;
    }
}

